package emulator.hardware;

public class HwWord extends HwNumber {

	public HwWord(HwByte lo, HwByte hi)	{
		super(hi.getNumber());
		shift(8);
		or(lo);
	}
	
	public HwWord(long number) {
		super(number);
	}
	
	public HwWord() {
		super(0);
	}

	@Override
	void normalize() {
		number &= 0xffff;
	}
	
	@Override
	public String toString() {
		String text = Integer.toHexString((int) number).toUpperCase();
		while (text.length() < 4)
			text = "0"+text;
		return text;
	}

	public HwByte hi() {
		return new HwByte(getNumber()>>8);
	}

	public HwByte lo() {
		return new HwByte(getNumber()&0xff);
	}
}
